import type { Meeting, MeetingEntity } from './meeting'
import type { Mt, MtEntity } from './mt'
export type IMcc = Mt | Meeting
/**拖拽的数据对象*/
export type DropDataMt = (MtEntity & { isMt: true }) | (MeetingEntity & { isMt: false })
export interface DropData<T = DropDataMt, K = { [key: string]: any }> {
	data?: {
		mt?: T
	} & K
	from?: string
}
export function makeMtParam(mt: IMcc) {
	if (mt.isMt) {
		return {
			e164: mt.e164,
			mt_id: mt.mtid || mt.mtKey || '',
			mt_ip: mt.mtIp,
			mt_key: mt.mtKey,
			name: mt.name,
			conf_e164: mt.confE164,
			account: mt.account,
			account_type: mt.accountType,
		}
	} else {
		return {
			e164: mt.account,
			mt_id: mt.mtKey,
			mt_ip: mt.ip,
			mt_key: mt.mtKey,
			name: mt.name,
		}
	}
}
export function makeMtEntityParam(mt: (MtEntity & { isMt: true }) | (MeetingEntity & { isMt: false })) {
	if (mt.isMt) {
		return {
			e164: mt.e164,
			mt_id: mt.mt_id,
			mt_ip: mt.mt_ip,
			mt_key: mt.mt_key,
			name: mt.name,
			conf_e164: mt.conf_e164,
			account: mt.account,
			account_type: mt.account_type,
		}
	} else {
		return {
			e164: mt.conf_id,
			mt_id: mt.mt_key,
			mt_ip: mt.ip,
			mt_key: mt.mt_key,
			name: mt.name,
		}
	}
}
